import store from "./index";
import { ICommonAction } from '@/interface/store';


const learnReducer = function (state = {...store?.state}, action: ICommonAction) {
  for (const key in store.actionNames) {
    if (action?.type === store.actionNames[key]) {
      return store?.actions?.[store.actionNames[key]]?.(state, action);
    }
  }
  return state;
}

export default learnReducer;